package com.code.springbootquartz.jobs;

import com.code.springbootquartz.service.TestService;
import org.quartz.Job;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.springframework.beans.factory.annotation.Autowired;

import java.io.Serializable;

/*
 * @author: liyufei
 * @date: 2018-07-13 16:02
 */
public class DemoJob implements Job,Serializable {

    @Autowired
    private TestService testService;

    @Override
    public void execute(JobExecutionContext jobExecutionContext) {
        try {
            /*JobDataMap jobDataMap = jobExecutionContext.getTrigger().getJobDataMap();
            long dateTime = jobDataMap.getLongFromString("dateTime");
            String abc = jobDataMap.getString("abc");
            System.out.println("====现在时间=======" + dateTime);
            System.out.println("========Job=======" + abc);*/
            System.out.println("demo..........");
            testService.test();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
